context switch:每秒上下文切换的次数. 我们都知道,Linux 是一个多任务操作系统,它支持远大于 CPU 数量的任务同时运行。 当然,这些任务实际上并不是真的在同时运行,而是因为系统在很短的时间内,将 CPU 轮流分配给它们,造成多任务同时运行的错觉。 而在每个任务运行前,CPU 都需要知道任务从哪里加载、又从哪里开始运行,也就是说,需要系统事先帮它设置好 CPU 寄存器和程序计数器(Program Counter,PC)。 CPU 寄存器,是 CPU 内置的容量小、但速度极快的内存。 而
Time spent switching is called context switch overhead. During this time, the CPU is not performing actual process work it’s just preparing to run the next process.
Threads don't switch instantaneously—after one thread blocks or yields to another, the kernel must save the settings before running another thread. The time to save this state and restore another is known as thread context-switch time.